<?php
	if(isset($_POST['btnLogin'])){
		include '../operations/connection.php';
		session_start(); 
	  	$username =  $_POST['txtUser'];
	   	$password = md5($_POST['txtPass']);
		if($username&&$password){
			include("../operations/login-result.php");
				
			if(empty($_POST['txtUser']) || empty($_POST['txtPass']))
			{
				$error = "ERROR: ";
				$errorMessage = "Fill up all fields.";
				echo $errorMessage;
				header( 'Location: ../login.php' );
			}
		
			else if(!empty($_POST['txtUser']) || !empty($_POST['txtPass']))
			{
				echo authenticate($_POST['txtUser'], $_POST['txtPass']);
			}
		}
	}
?>
